using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraRotator : MonoBehaviour { public float speed; [SerializeField] private Vector3 offsetPosition; public float xpos, ypos, zpos; void Start() { xpos = Random.Range(-6.0f, 6.0f); ypos = Random.Range(4.0f, 6.0f); zpos = -23.46704f;//Random.Range(-22.0f, -27.0f); Vector3 pos = transform.position; // get a copy pos.x = xpos; pos.y = ypos; pos.z = zpos; offsetPosition = pos; speed = Random.Range(-2,2); } void LateUpdate() { transform.Rotate(0, speed*Time.deltaTime, 0); } // Update is called once per frame /*void Update() { transform.Rotate(0,speed*Time.deltaTime, 0); }*/ void Update() { GameObject.Find("MainCamera").transform.position = new Vector3(xpos, ypos, zpos); } }